<template>
  <el-dialog title="添加电商" :visible.sync="dialogFormVisible" :before-close="close" :close-on-click-modal="false">
  <el-form :model="form">
    <el-form-item label="电商名称" :label-width="formLabelWidth">
      <el-input v-model="form.retailersName" auto-complete="off"></el-input>
    </el-form-item>
    <el-form-item label="电商编号" :label-width="formLabelWidth">
      <el-input v-model="form.retailersNo" auto-complete="off"></el-input>
    </el-form-item>
    <el-form-item label="活跃用户" :label-width="formLabelWidth">
      <el-input v-model="form.activeUsers" auto-complete="off"></el-input>
    </el-form-item>
    <el-form-item label="电商描述" :label-width="formLabelWidth">
      <el-input v-model="form.description" auto-complete="off"></el-input>
    </el-form-item>
    <el-form-item label="标签名称" :label-width="formLabelWidth">
      <el-input v-model="form.flag" auto-complete="off"></el-input>
    </el-form-item>
  </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="close">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </div>
  </el-dialog>
</template>
<script>
import { retailersSave } from 'api/retailers'
export default {
  data() {
    return {
      dialogFormVisible: true,
      form: {
        retailersName: '',
        description: '',
        flag: '',
        activeUsers: '',
        id: '',
        retailersNo: ''
      },
      formLabelWidth: '120px'
    }
  },
  methods: {
    close() {
      this.$emit('close')
    },
    async submit() {
      try {
        let back = await retailersSave(this.form)
        back = back.data
        if (back.resultCode === '200') {
          this.onlineData = back.result
          this.$emit('update')
        } else {
          this.$alert(back.msg, '提示')
        }
      } catch (err) {
        this.$alert('请求出错', '提示')
      }
    }
  }
}
</script>
